﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WFNetLib;
using Common;
using DAL;
using WFNetLib.StringFunc;

namespace 服务器端.webAPI
{
    public partial class SaveMedicalResult : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string post = WFHttpWebResponse.PostInput(Request.InputStream);
            RegResult ret = new RegResult();
            try
            {
                MedicalResultData MedicalResult = WFJSON.JsonDeserializeBySingleData<MedicalResultData>(post);
                byte[] bid = StringsFunction.strToHexByte(MedicalResult.TEID, "");
                lcyHashCal lcy = new lcyHashCal();
                MedicalResult.TEID = StringsFunction.byteToHexStr(lcy.HashCal(bid, 5), "");
                MedicalResult.Time = DateTime.Now;
                if (MedicalResultDataDBOption.Insert(MedicalResult) == 0)
                {
                    ret.message = "err";
                }
                else
                {
                    ret.message = "ok";
                }
            }
            catch (System.Exception ex)
            {
                ret.message = "未知错误" + ex.Message;
            }
            ret.DateTime = DateTime.Now.ToString();
            Response.Write(WFJSON.JsonSerializerBySingleData<RegResult>(ret));
        }
    }
}